package com.ego.admin.web.ctr;

import com.ego.common.web.domain.R;
import com.ego.common.web.domain.User;
import com.ego.system.mapper.UserMapper;
import com.ego.system.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * 测试登录
 */
@RestController
@Slf4j
@Api(tags = "测试登录接口--Api")
@RequestMapping("/Api")
//@CrossOrigin
public class LoginCollection {
    
    @Autowired
    private UserService userService;
    @ApiOperation("登录方法--login")
    @PostMapping("/login")
    
    public R login(@RequestBody User user) {
        try {
            return R.success(userService.login(user));
        }catch (Exception e){
            log.error("登录失败！"+user+);
            return R.failure("登录失败！");
        }
    }
}
